import request from '@/utils/request'

export function getHostList() {
  return request({
    url: '/deploy/hostList',
    method: 'post',
    data: '',
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}
export function hostListForOrg(type, pattern, name) {
  let data = {
    'type': type,
    'pattern': pattern,
    'name': name
  }
  return request({
    url: '/deploy/hostListForOrg',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}
export function deleteHost(mark, ip, name, password) {
  let data = {
    "mark": mark,
    "ip": ip,
    "name": name,
    "password": password
  };
  return request({
    url: '/deploy/delHost',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function addHost(form) {
  let data = {
    "mark": form.mark,
    "ip": form.ip,
    "name": form.name,
    "password": form.password
  };
  return request({
    url: '/deploy/addHost',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function alterPassword(form1, form2) {
  let data = {
    "user": form1,
    "password": form2
  };
  return request({
    url: '/deploy/alterPassword',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function isNull() {
  return request({
    url: '/deploy/isNull',
    method: 'post',
    data: '',
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function loadStatus() {
  return request({
    url: '/deploy/loadStatus',
    method: 'post',
    data: '',
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function alertStatus(fabric, deploy, gen, config, clean, extend) {
  let data = {
    'deploy_fabric': fabric,
    'extend_deploy': deploy,
    'extend_gen': gen,
    'gen_config': config,
    'network_clean': clean,
    'network_extend': extend
  }
  return request({
    url: '/deploy/alertStatus',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}
